import { createApp } from 'vue'
import App from './App.vue'
import MiniProgramManagement from './views/MiniProgramManagement.vue'
import KnowledgeBase from './views/KnowledgeBase.vue'
import CreateBusinessScenario from './views/CreateBusinessScenario.vue'
import BusinessScenarioDetail from './views/BusinessScenarioDetail.vue'
import ScenarioDataDetail from './views/ScenarioDataDetail.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  { path: '/', redirect: '/miniprogram' },
  { path: '/miniprogram', component: MiniProgramManagement },
  { path: '/knowledge', component: KnowledgeBase },
  { path: '/knowledge/create-business-scenario', component: CreateBusinessScenario },
  { path: '/knowledge/business-scenario-detail', component: BusinessScenarioDetail },
  { path: '/knowledge/scenario-data-detail', component: ScenarioDataDetail }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(ElementPlus)
app.use(router)
app.mount('#app')